// Copyright DustedPixels.com 2008. All rights reserved.

package com.dustedpixels.jasmin.unit.z80.v2;

/**
 * @author micapolos@gmail.com (Michal Pociecha-Los)
 */
public final class MCode {
  public int OPCODE;
  public int MCYCLE;
  public int TCYCLE;
  
  public int MCYCLES;
  public int TCYCLES;
  
  public boolean REG_READ;
  public boolean REG_WRITE;
  public int REG_A;
  public int REG_B;
  public int REG_C;
  
  public void update() {
    int sss = OPCODE & 0x07;
    int ddd = (OPCODE >>> 3) & 0x07;
    
    switch (OPCODE) {
      case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x47:
      case 0x48: case 0x49: case 0x4A: case 0x4B: case 0x4C: case 0x4D: case 0x4F:
      case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x57:
      case 0x58: case 0x59: case 0x5A: case 0x5B: case 0x5C: case 0x5D: case 0x5F:
      case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x67:
      case 0x68: case 0x69: case 0x6A: case 0x6B: case 0x6C: case 0x6D: case 0x6F:
      case 0x78: case 0x79: case 0x7A: case 0x7B: case 0x7C: case 0x7D: case 0x7F:
        // LD r,r' (B, C, D, E, H, L only)
        REGS_REG_OUT
        DATA = sss;
        REG_A = ddd;
        REG_WRITE = true;
        break;
    }
  }
}
